package com.zhuhjay.service.system.model.dto;


import com.zhuhjay.common.web.annotation.JsonDesensitization;
import com.zhuhjay.common.web.annotation.Matching;
import com.zhuhjay.service.system.model.entity.SystemUser;
import lombok.Data;

import static com.zhuhjay.common.web.enums.MatchingMode.Password;
import static com.zhuhjay.common.web.enums.MatchingMode.Username;

/**
 * 用户注册必填的表单信息，与登录Dto分离是为了增加注册表单的扩展性
 *
 * @author ZhuHJay
 * @date 2023/1/11 20:20
 */
@Data
public class UserRegisterDto {
    @Matching(Username)
    private String username;

    @JsonDesensitization
    @Matching(Password)
    private String password;

    public SystemUser bean2Entity() {
        SystemUser user = new SystemUser();
        user.setUsername(username);
        user.setPassword(password);
        return user;
    }
}
